home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows the use of QueryAddRow and QuerySetCell --->
- <HTML>
- <HEAD>
- <TITLE>
- QuerySetCell Example
- </TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
- <H3>QuerySetCell Example</H3>
-
- <!--- start by making a query --->
- <CFQUERY NAME="GetCourses" DATASOURCE="cfsnippets">
- SELECT Course_ID, Course_Num, Descript
- FROM Courses
- </CFQUERY>
-
- <P>The Query "GetCourses" has <CFOUTPUT>#GetCourses.RecordCount#</CFOUTPUT> rows.
-
- <CFSET CountVar = 0>
- <CFLOOP CONDITION="CountVar LT 15">
-
- <CFSET temp = QueryAddRow(GetCourses)>
- <CFSET CountVar = CountVar + 1>
- <CFSET Temp = QuerySetCell(GetCourses, "Course_ID", CountVar)>
- <CFSET CountVar = CountVar + 1>
- <CFSET Temp = QuerySetCell(GetCourses, "Course_Num", 100*CountVar)>
- <CFSET CountVar = CountVar + 1>
- <CFSET Temp = QuerySetCell(GetCourses, "Descript", "Description of variable #Countvar#")>
-
- </CFLOOP>
-
- <P>After the QueryAddRow action, the query has <CFOUTPUT>#GetCourses.RecordCount#</CFOUTPUT> records.
- <CFOUTPUT query="GetCourses">
- <PRE>#Course_ID# #Course_Num# #Descript#</PRE>
- </CFOUTPUT>
-
- </BODY>
- </HTML>
-